package com.inspur.security.cbb3.kms.keymanager.containers.po;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.inspur.security.cbb3.kms.keymanager.containers.vo.SecretRefVO;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description   容器表
 * @author  lijunchang
 */

@Entity
@Table ( name ="tb_containers" )
@Data
public class ContainersBean implements Serializable {

	private static final long serialVersionUID =  7512340314732727864L;


	@Id
	@GenericGenerator(name = "idGenerator", strategy = "uuid")
	@GeneratedValue(generator = "idGenerator")
	private String uuid;

	/**
	 * 生成时间
	 */
   	@Column(name = "created_time" )
	private String createdTime;

	/**
	 * 查询条件
	 * 生成时间起
	 */
	@Transient
	@JsonIgnore
	private String createdTimeBegin;

	/**
	 * 查询条件
	 * 生成时间止
	 */
	@Transient
	@JsonIgnore
	private String createdTimeEnd;


	/**
	 * 更新时间
	 */
   	@Column(name = "updated_time" )
	private String updatedTime;

	/**
	 * 删除时间
	 */
   	@Column(name = "delete_time" )
	private String deleteTime;

	/**
	 * 是否已删除,1-是，2-否
	 */
   	@Column(name = "deleted" )
	private Boolean deleted;

	/**
	 * 容器名称
	 */
	@NotBlank
   	@Column(name = "name" )
	private String name;

	/**
	 * 容器类型	generic、asymmetry、certificate
	 * {@link com.inspur.security.cbb3.kms.enums.ContainerType}
	 */
	@NotBlank
   	@Column(name = "type" )
	private String type;

	/**
	 * 创建订单用户id
	 */
   	@Column(name = "creator_id" )
	private String creatorId;

	/**
	 * 关联密钥信息
	 */
	@Transient
	private List<SecretRefVO> secretRefS=new ArrayList<>();

}
